<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script src="js/css-pop.js" type="text/javascript"></script>
<script type="text/javascript" src="js/dom-drag.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
function load_popup_carCrime(){
	loadAll_carcrime();
}
var flagOpenPopupCarcrime = 0;
var flagClosePopupCarcrime = 0;
function loadAll_carcrime(){
	try{
		var mauhabuoi = [];
		$.ajax({url:"content-home/load_all_carcrime.php?", data:$('#formCheck').serialize(),success:function(result){
			if($(result).html()==""){
				if(flagClosePopupCarcrime==0){
					closepopupss('root');
					flagOpenPopupCarcrime = 0;
					try{
						window.clearTimeout(OnEnd);
					}catch(err){}
				}
				flagClosePopupCarcrime = 1;
			}else{
				if(flagOpenPopupCarcrime==0){
					openpopupss('root');
					flagClosePopupCarcrime = 0;
					if($(result).find('.imga')!=""){
						$("#loadimage img").attr('src',$(result).find('.imga').html());
						$(result).find('.imga').html("");
					}
					OnEnded();
				}
				flagOpenPopupCarcrime = 1;
				$("input.checkcarcrime:checked").each(function(){
					mauhabuoi.push($(this).attr('id'));
				});
				$("#handel_mo").html(result);
				for(var i=0;i<mauhabuoi.length;i++){
					$("#"+mauhabuoi[i]).attr('checked',true);
				}
			}
			SDMO = window.setTimeout("loadAll_carcrime()",1000);
		}});
	}catch(err){
		SDMO = window.setTimeout("loadAll_carcrime()",1000);
	}
}
function processCheck(tenid){
	var field = $("input.checkcarcrime:checked").size();
	if(field > 0){
		document.getElementById('nameinsert').setAttribute("class","inbtn");
		document.getElementById('nameinsert').className = "inbtn";
		document.getElementById('nameinsert').disabled = false;
		var carnumber = document.getElementById(tenid).value;
		$.ajax({url:"content-home/load_image_popup_carcrime.php",data:{carnumber:carnumber},success:function(resultprocessCheck){
			$("#loadimage img").attr('src',resultprocessCheck);
		}});
		}else{
			document.getElementById('nameinsert').setAttribute("class","inbtnDisable");
			document.getElementById('nameinsert').className = "inbtnDisable";
			document.getElementById('nameinsert').disabled = true;
			return;
		}
}
function insertComment(userid1){  
	var userid=document.getElementById("iduserlogin").value;
	if(userid==""){
		document.getElementById("vaction").value="viewinsert";
        document.getElementById("txtName").value="";
        document.getElementById("txtPass").value="";
        document.getElementById("txtName").value="";
        document.getElementById("viewtb").value="";
        $( "#lmain" ).dialog({
            resizable: false,
            modal: true
        });
    	 $( "#lmain" ).dialog("open");
		}
	else{
		var field = $("input.checkcarcrime:checked").size();
		document.getElementById("txtcomment").value="";
		if(field > 0){
			$.ajax({url:"content-home/insert_comment_popup_carcrime.php", data:$('#formCheck').serialize(),success:function(result){
			}
			});
		}
	}
}
function inserAfterLogin(userid){
	var field = $("input.checkcarcrime:checked").size();
	if(field > 0){
		document.getElementById("txtcomment").value="";
		$.ajax({url:"content-home/insert_comment_popup_carcrime.php", data:$('#formCheck').serialize(),success:function(result){
		}
		});
	}
	}
$(document).ready(function(){
	settingSound();
});
function settingSound(){
	$("#iplayer").jPlayer({
	    ready: function () {
	    	jplay = $(this).jPlayer("setMedia", {
		    mp3: "images/alarm.mp3"
		    });
	    },
	    supplied: "mp3"
    });
}

function playSound() {
	$("#iplayer").jPlayer("play");
	
}
function stopSound() {
	$("#iplayer").jPlayer("pause");
}
function OnEnded(){
	stopSound();
	playSound();
	OnEnd = window.setTimeout("OnEnded()",6000);
}
</script>
